<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="keywords" content="licence,informatique,web,html" />
<meta name="description" content="Site web e-commerce" />
<meta name="author" content="Charles HURTEVENT Quentin LAUJAC" />
<link rel="stylesheet" href="style.css" />
<script type="text/javascript" src="fonctions.js"></script>
<title>Lepino compagny</title>
</head>
<body>
	<div id="bloc_page">
		<header>
			<div id="titre_principal">
				<h1>Lepino compagny</h1>
			</div>
			<p align="right">
			<?php include './affichage_user.php'; ?>
			</p>
			<form align="right" id="bouton"
				action="../action/deconnexionAction.php" method="post">
				<input id="deconnexion" name="deconnexion" type="submit"
					value="Se déconnecter" />
			</form>
		</header>

		<div id="banniere_image">
			<div id="banniere_description">
				<a href="./client.php" class="bouton_rouge">Retour au menu<img
					src="images/flecheblanchedroite.png" alt="" /> </a>
			</div>
		</div>

		<section>
			<article>
				<form id="historiqueCommandes" action="" onsubmit="" method="post">
					<table width="100%">
						<CAPTION>
							<h1>Historique des commandes</h1>
							<CAPTION />

							<th>N° commande</th>
							<th>Date commande</th>
							<th>Lieu de Livraison</th>
							<th>Montant total</th>
							<th>Date facture</th>
							<th>Montant facture</th>
							<th>Etat de la commande</th>
							<th>Etat du colis</th>
							<th>Détail</th>
							<tr>
							<?php
							require_once ("../bean/data/Commande.php");
							require_once ("../bean/data/Article.php");
							require_once ("../bean/data/Lieu.php");
							require_once ("../bean/data/Facture.php");

							session_start ();

							$id = 0;
							foreach ( $_SESSION ['listCommande'] as $commande ) {
								echo "<td>" . $commande->getNumeroCommande () . "</td>";
								echo "<td>" . $commande->getDateCommande () . "</td>";
								echo "<td>" . $commande->getLieuLivraison ()->getAdresse () . "</td>";
								echo "<td>" . $commande->getMontantTotal () . " &#8364</td>";
								echo "<td>" . $commande->getFacture ()->getDateFacture () . "</td>";
								if ($commande->getFacture ()->getMontantFacture () == NULL) {
									echo "<td></td>";
								} else {
									echo "<td>" . $commande->getFacture ()->getMontantFacture () . " &#8364</td>";
								}
								if ($commande->isValide ()) {
									echo '<td><FONT COLOR="green">Validee</FONT></td>';
								} else {
									echo '<td><FONT COLOR="red">Non validee</FONT></td>';
								}
								if ($commande->isColisFait()) {
									echo '<td><FONT COLOR="green">Fait</FONT></td>';
								} else {
									echo '<td><FONT COLOR="orange">Non fait</FONT></td>';
								}
								echo "<td>";
								echo "<form>";
								echo "<input type=\"button\" value=\"Details\"
										onclick=\"window.open('../action/detailsCommandeAction.php?var=" . $id . "', 'Détails commande', 'height=600, width=920, top=90, left=350, toolbar=no, menubar=no, location=yes, resizable=yes, scrollbars=yes, status=no');\">";
								echo "</form>";
								echo "</td>";
								echo "</tr>";
								$id ++;
							}
							?>
					
					</table>
				</form>
			</article>
		</section>
	</div>

</body>
</html>
